# Copyright (C) 2001, 2002  Earnie Boyd  <earnie@users.sf.net>
# This file is part of the Minimal SYStem.
#   http://www.mingw.org/msys.shtml
# 
#         File:	profile
#  Description:	Shell environment initialization script
# Last Revised:	2002.05.04

# *** Begin Modifs P. Robert : MINGW32 not used
#     ----------------------
if [ -z "$MSYSTEM" ]; then
  MSYSTEM=MINGW32
fi

# My decision to add a . to the PATH and as the first item in the path list
# is to mimick the Win32 method of finding executables.
#
# I filter the PATH value setting in order to get ready for self hosting the
# MSYS runtime and wanting different paths searched first for files.
# 
if [ $MSYSTEM == MINGW32 ]; then
 export PATH=".:/usr/local/bin:/mingw/bin:/bin:$PATH"
else
  export PATH=".:/usr/local/bin:/bin:/mingw/bin:$PATH"
fi

export PATH=".:/usr/mingw/bin:$PATH"

# *** end modifs P. Robert
#     --------------------

if [ -z "$USERNAME" ]; then
  LOGNAME="`id -un`"
else
  LOGNAME="$USERNAME" 
fi

# Set up USER's home directory
if [ -z "$HOME" ]; then
  HOME="/home/$LOGNAME"
fi

if [ ! -d "$HOME" ]; then
  mkdir -p "$HOME"
  cp /etc/inputrc.default "$HOME"/.inputrc
fi

if [ "x$HISTFILE" == "x/.bash_history" ]; then
  HISTFILE=$HOME/.bash_history
fi

export HOME LOGNAME MSYSTEM HISTFILE

#for i in /etc/profile.d/*.sh ; do
#  if [ -f $i ]; then
#    . $i
#  fi
#done

export MAKE_MODE=unix


# *** Begin Modifs P. Robert for the prompt
#     -------------------------------------

#export PS1='\[\033]0;$MSYSTEM:\w\007
#\033[32m\]\u@\h \[\033[33m\w\033[0m\]
#$ '

# WHITE="\[\033[1;37m\]"
# LIGHT_BLUE="\[\033[1;34m\]"
# YELLOW="\[\033[1;33m\]"
# NO_COLOUR="\[\033[0m\]"
# 0,1 contraire
# Black       1;30     Dark Gray     1;30
# Blue        1;34     Light Blue    0;34
# Green       1;32     Light Green   0;32
# Cyan        1;36     Light Cyan    0;36
# Red         1;31     Light Red     0;31
# Purple      1;35     Light Purple  0;35
# Brown       1;33     Yellow        1;33
# Light Gray  0;37     White         1;37

export PS1='\[\033[0;32m\]\h `date +%H:%M` TU \[\033[0;31m\]\w  \[\033[0m\] 
$'

# *** end modifs P. Robert for the prompt
#     -----------------------------------

alias clear=clsb
alias ll='ls -la'

##     ---------------------------------                                         
## *** Begin Modifs P. Robert for RCL 
##     ---------------------------------

# set tem pour utiliser vi ou vim
export TERM=xterm

# enlever le "buffering" par défaut de gfortran:            
export GFORTRAN_UNBUFFERED_ALL="y"    

# define full path of msys on unix form
sed 's%\\%/%'g  /dir_msys.dos > /dir_msys.lx
dir_msys=`cat /dir_msys.lx`
cd $dir_msys
cd RCL_V2p6
date 
echo ===============================================================================
echo
echo "        Welcome $USERNAME in Msys Unix Shell to use RCL Software"
echo 
echo "        You have now a linux terminal where you can do anything"
echo "        Current directory is `pwd`"
echo "        cd go to $HOME"
echo
echo "In case of any problems : patrick.robert@lpp.polytechnique.fr"
echo
echo ===============================================================================
echo

# start ../run_RCL_config.bash
com=${dir_msys}run_RCL_config.bash
. $com $dir_msys

## *** End   Modifs P. Robert for RCL
##     ------------------------------

